package cn.ch.basic.inteceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfiger implements WebMvcConfigurer {
    @Autowired
    private LoginInteceptor loginInteceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInteceptor)//添加拦截器
                .addPathPatterns("/**")//拦截所有
                .excludePathPatterns("/login/**")
                .excludePathPatterns("/shop/settlement")//放行
                .excludePathPatterns("/user/phoneRegister")
                .excludePathPatterns("/verifyCode/**")
                .excludePathPatterns("/fastDfs/**")
                .excludePathPatterns("/dept/**")
                .excludePathPatterns("/menu/**")//放行权限的功能
                .excludePathPatterns("/permission/**")//放行权限的功能
                .excludePathPatterns("/role/**")//放行权限的功能
                .excludePathPatterns("/employee/**");//放行权限的功能
    }
}
